<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="com.daowen.uibuilder.ShangpinBuilder"%>
<%@page import="com.daowen.uibuilder.ProductViewHistory"%>
<%@page import="java.util.*"%>
<%@page import="com.daowen.bll.*"%>
<%@page import="com.daowen.entity.*,com.daowen.dal.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <%
  
            String id=request.getParameter("id");
            String itemId=request.getParameter("itemId");
            if(itemId!=null){
				request.setAttribute("itemId",itemId);
			}
            if(id!=null){
            
            	Shangpin shangpin=(Shangpin)DALBase.load(Shangpin.class,new Integer(id));
                List huodong=DALBase.runNativeSQL("select shangpinid from jiaodiantu where shangpinid="+shangpin.getId());
                if (huodong.size() != 0){
                    request.setAttribute("huodonging",true);
				}else {
					request.setAttribute("huodonging",false);
				}
                if(shangpin!=null)
                   request.setAttribute("shangpin",shangpin);
                
            }
  
   %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>系统首页</title>
<link rel="stylesheet" href="<%=SystemParam.getSiteRoot() %>/e/css/index.css" type="text/css"></link>

<link rel="stylesheet" href="<%=SystemParam.getSiteRoot() %>/admin/css/web2table.css" type="text/css"></link>

<link rel="stylesheet" href="<%=SystemParam.getSiteRoot() %>/e/css/box.all.css" type="text/css"></link>

<link rel="stylesheet" href="<%=SystemParam.getSiteRoot() %>/e/css/leaveword.css" type="text/css"></link>

<script src="<%=SystemParam.getSiteRoot() %>/webui/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.1&services=true"></script>
    <script type="text/javascript">
    
            $(function(){
               
                 
            	
            	
                 
            })
    
    
    </script>
    
    
    <%
     
        ProductViewHistory.View(request, response, id);
    
    
    %>
   

    

</head>
<body>
    <input type="hidden" id="commentresurl" value="/e/shangpininfo.jsp?id=<%=id%>">
	
	<jsp:include page="head.jsp"></jsp:include>
	
	<div class="wrap">
	  <div class="cover-title">
                   当前位置：<a href="<%=SystemParam.getSiteRoot() %>/e/index.jsp">首页</a> &gt;&gt; 商品信息
      </div>
	</div>
	<input type="hidden" id="reUrl" name="reurl" value="/e/shangpininfo.jsp?id=<%=id%>"/>

	<div class="fn-clear"></div>
	
	<div class="wrap">
		<div >
		 
		   <div class="info">
                    <h1>
                           ${shangpin.name}
                    </h1>

				<table cellpadding="0" cellspacing="1" class="grid" width="100%">
					
					
					<tr>
						
						<td width="30%" colspan="2" rowspan="6">
						     <img id="imgTupian" width="200px" height="200px"
							src="${requestScope.shangpin.tupian}" />
					    </td>
					    <td width="10%" align="right">名称:</td>
						<td width="*">${requestScope.shangpin.name}</td>
					    
					</tr>
					
					<tr>
						<td align="right">商品编号:</td>
						<td>${requestScope.shangpin.spno}</td>
					</tr>
					<tr>
						<c:choose>
							<c:when test="${requestScope.huodonging != true}">
								<td align="right">价格:</td>
								<td>${requestScope.shangpin.jiage}￥</td>
							</c:when>
							<c:otherwise>
								<td align="right"><font color="red"> 活动价:</font></td>
								<td><font color="red"> ${requestScope.shangpin.jiage}￥</font></td>
							</c:otherwise>
						</c:choose>
					</tr>
					
					
					<tr>
						<td colspan="4" >
						  
					
                           
                            <form method="post" action="<%=SystemParam.getSiteRoot()%>/admin/shoucangmanager.do">
                                         <input type="hidden" name="bookid" value="<%=id%>"/>
                                          <input type="hidden" name="bookname" value="${shangpin.name}"/>
                                          <input type="hidden" name="tupian" value="${shangpin.tupian}"/>
                                         <input type="hidden" name="actiontype" value="save"/>
                                         <input type="hidden" name="scren" value="${huiyuan.accountname}"/>
                                         <input type="hidden" name="forwardurl" value="/e/shangpininfo.jsp?id=<%=id%>"/>
                                          <input type="hidden" name="errorurl" value="/e/shangpininfo.jsp?id=<%=id%>"/>
                                      
                                 <a id="btnIncart" class="btn btn-default" href="<%=SystemParam.getSiteRoot() %>/admin/dingdanmanager.do?actiontype=shopcart&spid=<%=id%>&forwardurl=/e/shopcart.jsp" > 
                                 <i class="fa fa-plus"></i>加入购物车
                              </a>
                                   
                                         <button  id="btnShoucang" class="btn btn-default"><i class="fa fa-star"></i>收藏商品</button>
                                    </form>
                                    
                                     ${errormsg}
						    
						    
						    
						    
						     
						 </td>
						
					</tr>
				</table>
				
				
				
	    
	             <%=new ShangpinBuilder().buildViewedProduct(request)%>
	
	

                 <div class="news-content">
					 <div class="title"><strong>商品介绍</strong></div>
			        ${requestScope.shangpin.jieshao}
			     </div>


			</div>
			



			<c:choose>
				<c:when test="${ not empty itemId}">
					<jsp:include page="comment.jsp?commenttype=shangpin&itemId=${itemId}"></jsp:include>
				</c:when>
				<c:otherwise>
					<jsp:include page="comment.jsp?commenttype=shangpin"></jsp:include>
				</c:otherwise>
			</c:choose>

		
		</div>
		
	</div>
	
	
	
	<div class="fn-clear"></div>


	<jsp:include page="bottom.jsp"></jsp:include>



</body>
</html>